/*
 * @Author: Tim
 * @Date: 2020-08-04 15:33:21
 * @LastEditTime: 2020-08-04 15:33:46
 * @LastEditors: Please set LastEditors
 * @Description: promise扩展函数
 * @FilePath: /afire/src/utils/promise.extend.js
 */
/**自定义promise finally结束函数 */
!(function () {
    //添加finally结束
    if (typeof Promise.prototype.finally !== "function") {
        Promise.prototype.finally = function (callback) {
            var Promise = this.constructor;
            return this.then(
                function (value) {
                    Promise.resolve(callback()).then(function () {
                        return value;
                    });
                },
                function (reason) {
                    Promise.resolve(callback()).then(function () {
                        throw reason;
                    });
                }
            );
        };
    }
})();